const app = getApp(),url = app.globalData.url;
var lineHeight = 0;
var endWords = "";
var isNum;
Page({
  data: {
    index:0,
    arr:[
      // {
      //   id:1,fname:"互联网网",
      //   childer:[
      //     {id:11,flname:'电子/半导体/集成电路', isSelected:false},
      //   ],
      // },
      // {
      //   id:2,fname:"房地产",
      //   childer:[
      //     {id:4312,flname:'集成电路', isSelected:false},
      //   ],
      // },
      // {
      //   id:3,fname:"金融业",
      //   childer:[
      //     {id:412,flname:'33电子/半导体/集成电路', isSelected:false},
      //   ],
      // },
      // {
      //   id:31,fname:"2金1融3业",
      //   childer:[
      //     {id:412,flname:'33电子/半导体/集成电路', isSelected:false},
      //   ],
      // },
    ],
    showModal:false,
    searchArr:[],
  },
  // 保存
  yes_but(){
    var that = this
    var zhiwei = that.data.zhiwei
    wx.setStorageSync('zhiwei', zhiwei)
    that.setData({searchArr:[]})
    wx.navigateBack({
      delta: 1,
    })
  },
  reset(){
    var that = this
    that.setData({searchArr:[]})
  },
  onLoad: function (options) {
    var that = this
    
    // var arr = that.data.arr
    // var index = that.data.index
    // that.setData({
    //   arrlist:arr,
    //   fid:arr[index].id,
    //   arrchilder:arr[index].childer//二级数组
    // })
  },
  // 点一级分类
  btn(e){
    var that = this
    // var id = e.currentTarget.dataset.id
    var index = e.currentTarget.dataset.index
    var arr = that.data.arr
    console.log(index)
    console.log(arr)
    that.setData({
      arr:arr,
      fid:arr[index].id,
      contentSet:arr[index].contentSet
    })
  },
  // 选择 选中
  xuanzeid: function (e) {
    var id = e.currentTarget.dataset.id;
    var zhiwei = e.currentTarget.dataset.zhiwei;
    console.log(id)
    this.setData({seleid:id,zhiwei:zhiwei})
  },
  // 顶级 第一个页面
  dingji(e){
    var id = e.currentTarget.dataset.id;
    this.setData({showModal:true})
  },
  // 取消 弹框
  quxiao(){
    this.setData({showModal:false})
  },
  onReady: function () {
    var that = this
  },
  onShow: function () {
    var that = this
    var index = that.data.index
    // 获取所有职位
    wx.request({
      url:url+'position/getAllPositionByPage',
      method: "GET",
      data:{
        pageNum :1,pageSize:150
      },
      success:function(res){
        console.log('获取所有职位',res)
        var arr = res.data.data.content
        that.setData({
          arr:res.data.data.content,
          fid:arr[index].id,
          contentSet:arr[index].contentSet//二级数组
        })
      }
    })





  },

  searchBut(e){
    var that = this
    console.log(e.detail.value)
		var uid = wx.getStorageSync('user_massage')
    wx.request({
			url: url + 'position/findWorkList',
			method:'POST',
			data: {
        companySize:'',//公司规模
        industry:'',//所属行业
        enterpriseNature:'',//企业性质
        wageRange:'',//薪资范围
        educational:'',//学历
        positionName:e.detail.value,//职位名称
        pageNum :1,
        pageSize :7777,
        userUid:uid.userUid ? uid.userUid : '' ,
      },
			success: function(res)
			{
				console.log(res)
				that.setData({searchArr:res.data.data.content})
			},
			fail:function(res){
				console.log(res)

			}
		})
    
  },
  
})